//
//  feilvView.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/11/15.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "feilvView.h"

static CGFloat imagesize = 15;

@interface feilvView (){
    UILabel *namelabel;
    UILabel *customLabel;
    UILabel *vipLabel;
    UIImageView *imageV;
}

@end

@implementation feilvView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)initWithFrame:(CGRect)frame isShowIamge:(BOOL)isShow{
    self = [super initWithFrame:frame];
    if (self) {
        CGFloat width = frame.size.width;
        CGFloat height = frame.size.height;
        imageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, (height-imagesize)/2, isShow?imagesize:0, imagesize)];
        [self addSubview:imageV];
        CGFloat changespace = 5;
        CGFloat labelwidth = (width-imageV.frame.size.width-changespace)/3;
        namelabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(imageV)+changespace, 0, labelwidth, height) text:@"" font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:nil];
        [self addSubview:namelabel];
        
        customLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(namelabel), 0, labelwidth, height) text:@"" font:12 textAlignment:NSTextAlignmentCenter texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:nil];
        [self addSubview:customLabel];
        
        vipLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(customLabel), 0, labelwidth, height) text:@"" font:12 textAlignment:NSTextAlignmentCenter texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:nil];
        [self addSubview:vipLabel];
    }
    return self;
}

- (void)setValueWithCustom:(NSString *)custom vip:(NSString *)vip name:(NSString *)name iamgeName:(NSString *)imagename{
    
    imageV.image = [UIImage imageNamed:imagename];
    namelabel.text = name;
    customLabel.text = custom;
    vipLabel.text = vip;
    
}
@end
